<?php

namespace common\models\ar;

use Yii;

/**
 * This is the model class for table "hold_positions".
 *
 * @property string $positionID 持仓唯一编号
 * @property string $UserID 持仓用户的编号
 * @property string $InstrumentID 持仓品种的id
 * @property string $Direction 持仓方向1买2卖
 * @property string $price 持仓价格
 * @property string $totalVolume 持仓总手数
 * @property string $Deposit 持仓保证金
 * @property string $userName
 * @property string $loginName 持仓账户的登录Id
 * @property string $instrumentName
 * @property int $prePositionVolume 昨仓量
 * @property string $prePositionDeposit 昨持仓保证金占用
 * @property int $preModifyFlag
 * @property string $OpenTime
 * @property int $tradeId 持仓对应的开仓Id
 * @property int $brokerId 持仓账户对应的代理Id
 * @property int $hedgeStrategy 5模拟6正向7反向
 */
class HoldPositions extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'hold_positions';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['UserID', 'InstrumentID', 'Direction', 'price', 'totalVolume', 'Deposit'], 'required'],
            [['UserID', 'InstrumentID', 'Direction', 'totalVolume', 'prePositionVolume', 'preModifyFlag', 'tradeId', 'brokerId', 'hedgeStrategy'], 'integer'],
            [['price', 'Deposit', 'prePositionDeposit'], 'number'],
            [['OpenTime'], 'safe'],
            [['userName', 'loginName', 'instrumentName'], 'string', 'max' => 50],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'positionID' => 'Position ID',
            'UserID' => 'User ID',
            'InstrumentID' => 'Instrument ID',
            'Direction' => 'Direction',
            'price' => 'Price',
            'totalVolume' => 'Total Volume',
            'Deposit' => 'Deposit',
            'userName' => 'User Name',
            'loginName' => 'Login Name',
            'instrumentName' => 'Instrument Name',
            'prePositionVolume' => 'Pre Position Volume',
            'prePositionDeposit' => 'Pre Position Deposit',
            'preModifyFlag' => 'Pre Modify Flag',
            'OpenTime' => 'Open Time',
            'tradeId' => 'Trade ID',
            'brokerId' => 'Broker ID',
            'hedgeStrategy' => 'Hedge Strategy',
        ];
    }
}
